14. Task Configuration

Task Configuration

INSTRUCTOR NOTE:

** DEPRECATION WARNING **

Oh no! The leftShift (<<) syntax I talk about at 1:55 is now deprecated! It'll be removed in Gradle version 5, so it'll continue to work for a while yet, but you should declare tasks like this:

task myTask {
    doLast {
         println "Herp Derp"
    }
}

Instead of like this:

task myTask << { // Don't do this!
     println "Herp Derp"
}

The code for this demo is in the 1.06-Demo-TaskConfiguration folder.

You can find the Gradle DSL guide entry on the Project object here, and the entry on the Task object here.

To learn more about the Gradle magic that allows you to omit the quotes, check out Mark's Stack Overflow answer here.

The task properties that can be set using the map syntax can be found here.